const {axiosFn } = require('./config')

//第一屏 歌单里面的歌曲列表
let _PostSongList = (dissid, callback) => {
  console.log(dissid)
  const url = `https://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg?type=1&json=1&utf8=1&onlysong=0&disstid=${dissid}&g_tk=844366160&loginUin=1573199956&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq&needNewCode=0`

  axiosFn(url,callback)
}

// 第二屏，歌手里面的歌曲详情
let _PostSingerDetail = (singermid, callback) => {
  const url = `https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq&needNewCode=0&singermid=${singermid}&order=listen&begin=0&num=100&songstatus=1`

  axiosFn(url,callback)
}

//通用接口，获取歌曲歌词
let _PostLyric = (songmid, callback) => {
  const url = `https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg?pcachetime=${new Date()}&songmid=${songmid}&g_tk=844366160&loginUin=1573199956&hostUin=0&platform=yqq&needNewCode=0`

  axiosFn(url,callback)
}

//通用接口，获取歌曲播放的key值
let _PostMusicInfo = (songmid, callback) => {
  const url = `https://c.y.qq.com/base/fcgi-bin/fcg_music_express_mobile3.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq&needNewCode=0&cid=205361747&uin=0&songmid=${songmid}&filename=C400${songmid}.m4a&guid=4389467480`

  axiosFn(url,callback)
}

//第三屏，排行榜里面的歌曲
let _PostRankMusic = (topid, callback) => {
  const url = `https://c.y.qq.com/v8/fcg-bin/fcg_v8_toplist_cp.fcg?g_tk=844366160&uin=1573199956&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=h5&needNewCode=1&tpl=3&page=detail&type=top&topid=${topid}&_=1527165836385`

  axiosFn(url,callback)
}

// 第四屏，搜索请求数据
let _PostSearchList = (query, zhida, page,perpage,callback) => {
  const url = `https://c.y.qq.com/soso/fcgi-bin/search_for_qq_cp?g_tk=844366160&uin=1573199956&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=h5&needNewCode=1&w=${encodeURI(query)}&zhidaqu=1&catZhida=${zhida}&t=0&flag=1&ie=utf-8&sem=1&aggr=0&perpage=${perpage}&n=${perpage}&p=${page}&remoteplace=txt.mqq.all&_=1527322890948`

  console.log(url)
  axiosFn(url,callback)
}

module.exports = {
  _PostSongList,
  _PostSingerDetail,
  _PostLyric,
  _PostMusicInfo,
  _PostRankMusic,
  _PostSearchList
}